package model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
public class Aula {

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id_aula")
	private Long id;
	private String conteudo;
	
	@ManyToOne(targetEntity = Disciplina.class)
	@JoinColumn(name = "aula_disciplina_id")
	private Disciplina disciplinas;
	
	@ManyToMany(targetEntity = Aluno.class,cascade = CascadeType.ALL,fetch = FetchType.EAGER)
	@JoinTable(
			   name = "tb_aluno_aula",
			   joinColumns={
					   @JoinColumn(name = "id_aula",referencedColumnName = "id_aula")	   
			    			
			   },
			   inverseJoinColumns={
					   @JoinColumn(name = "id_aluno",referencedColumnName = "id_aluno")	  
			   }		   
	)
	private List<Aluno> alunos;
	
	private String inicio;
	
	private String fim;
	
	@Temporal(TemporalType.DATE)
	private Date data;

	
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getConteudo() {
		return conteudo;
	}
	public void setConteudo(String conteudo) {
		this.conteudo = conteudo;
	}

	public List<Aluno> getAlunos() {
		return alunos;
	}
	public void setAlunos(List<Aluno> alunos) {
		this.alunos = alunos;
	}

	public Disciplina getDisciplinas() {
		return disciplinas;
	}
	public void setDisciplinas(Disciplina disciplinas) {
		this.disciplinas = disciplinas;
	}

	public Date getData() {
		return data;
	}
	public void setData(Date data) {
		this.data = data;
	}
	public String getInicio() {
		return inicio;
	}
	public void setInicio(String inicio) {
		this.inicio = inicio;
	}
	public String getFim() {
		return fim;
	}
	public void setFim(String fim) {
		this.fim = fim;
	}

	
}
